﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CCH.DAO;

public partial class _50_5002 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ((MasterPage)this.Master).Create_menu(5004);

        if (!this.IsPostBack)
        {
            this.DropDownList1.Items.Insert(0, new ListItem("全部", "0"));
            this.GridView1.DataBind();
            
        }

        //判斷來自JS 使用_doPostBack(updatePanel,"") 的情況
        if (Request["__EVENTTARGET"] == this.UpdatePanel1.ClientID && String.IsNullOrEmpty(Request["__EVENTARGUMENT"]))
        {
            this.GridView1.DataBind();
        }
    }

    protected String Get_classificationName(object cla_no)
    {
        int clano = Convert.ToInt32(cla_no);

        return new classificationDAO().Get_classificaitonName(clano);
    }

    protected String Get_peopleName(object peo_uid)
    {
        int uid = Convert.ToInt32(peo_uid);

        return new peopleDAO().Get_peopleName(uid);
    }

    protected String Get_DateTime(object datetime)
    {
        return ((DateTime)datetime).ConvertToROCDT();
    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowIndex = System.Convert.ToInt32(e.CommandArgument);
        int id = System.Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value.ToString());

        //停用
        if (e.CommandName.Equals("disable"))
        {
            new youtubeDAO().Delete_youtube(id, new SessionObject().SessionUserID);
            this.GridView1.DataBind();
        }
    }
}